---
layout: example.html
title: Layer Spy
shortdesc: View a portion of one layer over another
docs: >
  <p>Layer rendering can be manipulated in <code>prerender</code> and <code>postrender</code> event listeners.
  These listeners get an event with a reference to the Canvas rendering context.
  In this example, the <code>prerender</code> listener sets a clipping mask around the most
  recent mouse position, giving you a spyglass effect for viewing one layer over another.</p>
  <p>Move around the map to see the effect.  Use the ↑ up and ↓ down arrow keys to adjust the spyglass size.</p>
tags: "spy, image manipulation, maptiler"
cloak:
  - key: get_your_own_D6rA4zTHduk6KOKTXzGB
    value: Get your own API key at https://www.maptiler.com/cloud/
---
<div id="map" class="map"></div>
